#include <stdio.h>

int main(int argc, char const *argv[])
{
    long a = 0x1;
    long max;

    while(1)
    {
        // 移位之前保留a的值
        max = a;

        a <<= 1; // 0000.....000010
        a |= 1;  // 0000.....000011

        if(a < 0)
            break;
    }
    printf("最大值：%ld\n", max);
    printf("最大值：%ld\n", ~(0x1L << (sizeof(long)*8-1)));

    return 0;
}
